package com.edushare.activity;

import java.io.IOException;
import java.net.URL;

import com.edushare.R;
import com.edushare.controller.EntityController;
import com.edushare.entity.Globals;
import com.edushare.entity.User;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;


public class SplashScreen extends Activity {

	// Splash screen timer
	private static int SPLASH_TIME_OUT = 3000;

	
	private class getUser extends AsyncTask<String, String, String> {


		@Override
		protected String doInBackground(String... params) {

			EntityController ec = new EntityController();
			User us = ec.retrieveUser(Globals.uid);
			Globals.id = us.getId();	

			return null;
		}// return 

		@Override
		protected void onPostExecute(String result) {

			Intent i = new Intent(SplashScreen.this, GroupActivity.class);
			startActivity(i);

			// close this activity
			finish();
		}
		
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash_screen);

		new getUser().execute();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.splash_screen, menu);
		return true;
	}

}
